<template>
  <a-modal
    title="查看错误明细"
    width="70%"
    :visible="visible"
    :footer="null"
    @cancel="
      () => {
        this.visible = false
      }
    "
  >
    <a-table
      ref="table"
      :scroll="{ y: 560 }"
      :columns="columns"
      :rowKey="row => row.Id"
      :dataSource="data"
      :pagination="pagination"
      :loading="loading"
      @change="handleTableChange"
      :bordered="true"
      size="small"
    >
      <template slot="dataIndex" slot-scope="text, record, index">
        <span>{{ (pagination.current - 1) * pagination.pageSize + index + 1 }}</span>
      </template>
    </a-table>
    <div
      :style="{
        position: 'absoult',
        right: 0,
        bottom: 0,
        width: '100%',
        borderTop: '1px solid #e9e9e9',
        padding: '10px 16px',
        background: '#fff',
        textAlign: 'right',
        zIndex: 1
      }"
    >
      <a-button type="primary" @click="getDataList" style="float: left">刷新</a-button>
      <a-button type="primary" @click="handleSubmit">保存</a-button>
    </div>
  </a-modal>
</template>

<script>
const columns = [
  {
    title: '序号',
    dataIndex: 'aId',
    scopedSlots: { customRender: 'dataIndex' },
    width: '50px'
  },
  { title: '物品类型', dataIndex: 'MaterialTypeName' },
  { title: '物品编码', dataIndex: 'Code' },
  { title: '物品名称', dataIndex: 'Name' },
  { title: '物品规格', dataIndex: 'Spec' },
  { title: '单位', dataIndex: 'UnitGroupName' }
]
export default {
  components: {
    parentObj: Object
  },
  data() {
    return {
      visible: false,
      loading: false,
      columns,
      data: [],
      pagination: {
        current: 1,
        pageSize: 25,
        showTotal: (total, range) => `总数:${total} 当前:${range[0]}-${range[1]}`,
        pageSizeOptions: ['25', '50', '100'], //设置pageSize的可选值，页面啊可以通过下拉框进行选择
        showSizeChanger: true,
        onShowSizeChange: (current, pageSize) => (this.pageSize = pageSize)
      }
    }
  },
  methods: {
    openForm() {
      this.visible = true
    },
    handleSubmit() {},
    handleTableChange(pagination, filters, sorter) {
      this.pagination = { ...pagination }
      this.filters = { ...filters }
      this.sorter = { ...sorter }
      this.getDataList()
    },
    getDataList() {}
  }
}
</script>

<style></style>
